<template>
  <div class="app-container">
    <div style="text-align: center;margin-bottom: 30px">
      视频设备详情
    </div>
    <el-form :model="cameraForm" ref="cameraForm" :rules="cameraFormRules" label-width="100px">
      <el-form-item label="视频设备名称" prop="name">
        <el-input type="text" v-model="cameraForm.name" placeholder="请输入视频设备名称"
                  clearable></el-input>
      </el-form-item>
      <el-form-item label="设备编号" prop="code">
        <el-input type="text" v-model="cameraForm.code" placeholder="请输入设备编号"
                  clearable></el-input>
      </el-form-item>
      <el-form-item label="设备IP地址" prop="ip">
        <el-input type="text" v-model="cameraForm.ip" placeholder="请输入设备IP地址"
                  clearable></el-input>
      </el-form-item>
      <el-form-item label="所属区域"  prop="regionId">
        <el-input type="text" v-model="cameraForm.regionName" placeholder="请输入设备IP地址"
                  clearable></el-input>
      </el-form-item>
    </el-form>


    <div slot="footer" style="text-align: center" class="dialog-footer">
      <el-button @click="cancelData">取 消</el-button>
    </div>
  </div>
</template>

<script>
import {getData, addData, updateData} from "@/api/camera";
import {getToken} from "@/utils/auth";
import {getInEnterpriseDataList} from "@/api/enterpriseDominant";
import {getRegionList} from "@/api/enterprise";

export default {
  name: "dataEdit",
  components: {},
  data() {
    return {
      cameraForm: {
        name: "",
        regionId: "",
        code: "",
        ip: ""
      },
      addLoading: false,
      regionList: []
    }
  },
  computed: {
    createStatus() {
      return this.$route.params.ucId == '0'
    },
    headers() {
      return {
        'Authorization': getToken()
      }
    }
  },
  created() {
    let ucId = this.$route.params.ucId
    this.getData(ucId)
  },
  methods: {
    getRegionList(){
      getRegionList({}).then(res=>{
        this.regionList = res.data
      })
    },
    getData(val) {
      getData({ucId: val}).then(res => {
        this.cameraForm = res.data
      }).catch(res => {

      })
    },
    cancelData() {
      window.history.back()
    }
  }
}
</script>

<style>
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 149px;
  height: 149px;
  line-height: 149px;
  text-align: center;
}

.avatar {
  width: 149px;
  height: 149px;
  display: block;
}
</style>
